<?php print_r($_FILES); print_r($_POST); 

 /* Simple file write
 $File = "YourFile.txt"; 
 $Handle = fopen($File, 'w');
 $Data = "Jane Doe\n"; 
 fwrite($Handle, $Data); 
 $Data = "Bilbo Jones\n"; 
 fwrite($Handle, $Data); 
 print "Data Written"; 
 fclose($Handle); 
 */
 
Header('Cache-Control: no-cache');
Header('Pragma: no-cache');

 // Where the file is going to be placed 
$target_path = "paste/";

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['thefilename']['name']); 

if(move_uploaded_file($_FILES['thefilename']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['thefilename']['name']). 
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}

 ?>
